package com.gxuwz.medical.tool;

import org.junit.Test;

public class PasswordTest {

	/**
	 * 
	 * @Title: MD5Test @Description: 瀵嗙爜鍔犲瘑宸ュ叿绫绘祴璇� @author 闄堥渿娲� @throws
	 *         Exception @throws
	 */

	@Test
	public void MD5Test() throws Exception {
		String encode = PasswordUtil.MD5Encode("admin", "UTF8", true);
		System.out.println();
		System.out.println("MD5锟姐法:" + encode);
	}

	@Test
	public void aesTest() throws Exception {
		String content = "123456";
		String aesKey = "ming";

		byte[] encrypt = PasswordUtil.AESEncrypt(content, aesKey);// 加密
		System.out.println("AES加密后-byte[]:" + encrypt);

		String strHex = PasswordUtil.parseByte2HexStr(encrypt);
		System.out.println("转换后的十六进制:" + strHex);

		byte[] decrypt = PasswordUtil.AESDecrypt(PasswordUtil.parseHexStr2Byte(strHex), aesKey);// 解密

		System.out.println("AES解密-byte[]" + decrypt);
		System.out.println("AES解密成功后:" + new String(decrypt));
	}

}